﻿#include <CommonUnits/Units/Capacitance.h>
#include <gtest/gtest.h>

TEST(CapacitanceTest, CastTest)
{
    EXPECT_EQ(CU::Farad(1e3), CU::Kilofarad(1));
    EXPECT_EQ(CU::Kilofarad(1e3), CU::Megafarad(1));
    EXPECT_EQ(CU::Megafarad(1e3), CU::Gigafarad(1));
    EXPECT_EQ(CU::Gigafarad(1e3), CU::Terafarad(1));
    EXPECT_EQ(CU::Terafarad(1e3), CU::Petafarad(1));
    EXPECT_EQ(CU::Petafarad(1e3), CU::Exafarad(1));
    EXPECT_EQ(CU::Millifarad(1e3), CU::Farad(1));
    EXPECT_EQ(CU::Microfarad(1e3), CU::Millifarad(1));
    EXPECT_EQ(CU::Nanofarad(1e3), CU::Microfarad(1));
    EXPECT_EQ(CU::Picofarad(1e3), CU::Nanofarad(1));
    EXPECT_EQ(CU::Femtofarad(1e3), CU::Picofarad(1));
    EXPECT_EQ(CU::Attofarad(1e3), CU::Femtofarad(1));
}

TEST(CapacitanceTest, Literals)
{
    using namespace CU::Capacitance::Literals;
    EXPECT_EQ(1e3_F, 1.0_kF);
    EXPECT_EQ(1e3_kF, 1.0_MF);
    EXPECT_EQ(1e3_MF, 1.0_GF);
    EXPECT_EQ(1e3_GF, 1.0_TF);
    EXPECT_EQ(1e3_TF, 1.0_PF);
    EXPECT_EQ(1e3_PF, 1.0_EF);
    EXPECT_EQ(1e3_mF, 1.0_F);
    EXPECT_EQ(1e3_uF, 1.0_mF);
    EXPECT_EQ(1e3_nF, 1.0_uF);
    EXPECT_EQ(1e3_pF, 1.0_nF);
    EXPECT_EQ(1e3_fF, 1.0_pF);
    EXPECT_EQ(1e3_aF, 1.0_fF);
}

TEST(CapacitanceTest, ToUnit)
{
    using namespace CU::Capacitance::Literals;
    EXPECT_EQ(1e3_F, CU::Capacitance::toUnit<CU::Farad>(1, CU::Kilofarad::unit()));
    EXPECT_EQ(1e3_kF, CU::Capacitance::toUnit<CU::Kilofarad>(1, CU::Megafarad::unit()));
    EXPECT_EQ(1e3_MF, CU::Capacitance::toUnit<CU::Megafarad>(1, CU::Gigafarad::unit()));
    EXPECT_EQ(1e3_GF, CU::Capacitance::toUnit<CU::Gigafarad>(1, CU::Terafarad::unit()));
    EXPECT_EQ(1e3_TF, CU::Capacitance::toUnit<CU::Terafarad>(1, CU::Petafarad::unit()));
    EXPECT_EQ(1e3_PF, CU::Capacitance::toUnit<CU::Petafarad>(1, CU::Exafarad::unit()));
    EXPECT_EQ(1e3_mF, CU::Capacitance::toUnit<CU::Millifarad>(1, CU::Farad::unit()));
    EXPECT_EQ(1e3_uF, CU::Capacitance::toUnit<CU::Microfarad>(1, CU::Millifarad::unit()));
    EXPECT_EQ(1e3_nF, CU::Capacitance::toUnit<CU::Nanofarad>(1, CU::Microfarad::unit()));
    EXPECT_EQ(1e3_pF, CU::Capacitance::toUnit<CU::Picofarad>(1, CU::Nanofarad::unit()));
    EXPECT_EQ(1e3_fF, CU::Capacitance::toUnit<CU::Femtofarad>(1, CU::Picofarad::unit()));
    EXPECT_EQ(1e3_aF, CU::Capacitance::toUnit<CU::Attofarad>(1, CU::Femtofarad::unit()));
}

int main(int argc, char* argv[])
{
    testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}